<%@ page import="java.util.* , com.listener.*, com.servlet.model.database.* "%>
<%
	String usernameCookie = null;
	String passwordCookie = null;
	Cookie[] cookies = request.getCookies();
	String redirectURL= "login";
	if (cookies != null) {
		for (Cookie cookie : cookies) {
			if ("SESSION_LOGIN_USERNAME".equals(cookie.getName()) ) {
				usernameCookie = cookie.getValue(); 
			}
			if ("SESSION_LOGIN_PASSWORD".equals(cookie.getName())) {
				passwordCookie = cookie.getValue(); 
			}
		}
		if (usernameCookie != null && passwordCookie != null) { 
			BaseAcces base = ContextListener.base;
			if (base.verifyAccount(usernameCookie, passwordCookie)) {
				redirectURL = "news";
			}
		}
	}
	response.sendRedirect(redirectURL);
%>
